home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.4 Applications 1997 August / SGI IRIX 6.4 Applications 1997 August.iso / dist / impr_rip.idb / var / tmp / addpsriplicense.sh.z / addpsriplicense.sh
Encoding:
Text File  |  1997-07-30  |  2.2 KB  |  87 lines

  1. #!/sbin/sh
  2. #
  3. #       Install a FLEXlm license
  4. #
  5. #       This file should be installed nohist and executed in an postop
  6. #       to install a FLEXlm license entry
  7. #
  8. ##########################################################################
  9. # Customomize the following area for the license
  10. ##########################################################################
  11.  
  12. FEATURE="Impressario"
  13. DAEMON="sgifd"
  14. VERSION="2.000"
  15. EXPIRATION="01-jan-0"
  16. NUMLICENSES="0"
  17. PASSWORD="00000000000000000000"
  18. VENDORINFO="Impressario"
  19. ISSUER="Silicon Graphics, Inc."
  20.  
  21. # Comment the first line and uncomment the next two after it if this
  22. # license is intended for only one host
  23. #HOSTID="ANY"
  24. SYSINFO=`/etc/sysinfo -s`
  25. HOSTID=`echo $SYSINFO 16o p | dc`
  26.  
  27. LICENSEDIR="/var/flexlm"
  28. LICENSEFILE="license.dat"
  29.  
  30. ##########################################################################
  31. # The following remains the same for all licenses
  32. ##########################################################################
  33.  
  34. # Use the following pattern to confirm that the license lines already exists
  35.  
  36. SEARCHLINE="FEATURE $FEATURE $DAEMON $VERSION"
  37.  
  38. if test -r "$LICENSEDIR/$LICENSEFILE"
  39. then
  40.     if grep "$SEARCHLINE" "$LICENSEDIR/$LICENSEFILE" > /dev/null
  41.     then
  42.         # license line exists, nothing further to do
  43.         exit 0
  44.     else
  45.         # Need to add license to existing file
  46.         if test -w "$LICENSEDIR/$LICENSEFILE"
  47.         then
  48.             true
  49.         else
  50.             echo "No permission to write to $LICENSEDIR/$LICENSEFILE" 1>&2
  51.             exit 1
  52.         fi
  53.     fi
  54. else
  55.     # create the directory if needed
  56.  
  57.     if test -d "$LICENSEDIR"
  58.     then
  59.         true
  60.     else
  61.         if mkdir -p "$LICENSEDIR"
  62.         then
  63.             true
  64.         else
  65.             exit 1
  66.         fi
  67.     fi
  68.  
  69.     # try to create the file
  70.  
  71.     if touch "$LICENSEDIR/$LICENSEFILE"
  72.     then
  73.         true
  74.     else
  75.         exit 1
  76.     fi
  77. fi
  78.  
  79. # Add the license lines
  80.  
  81. echo "FEATURE $FEATURE $DAEMON $VERSION $EXPIRATION $NUMLICENSES $PASSWORD HOSTID=$HOSTID \\" >> "$LICENSEDIR/$LICENSEFILE"
  82. echo "\tvendor_info=\"$VENDORINFO\" \\" >> "$LICENSEDIR/$LICENSEFILE"
  83. echo "\tISSUER=\"$ISSUER\"" >> "$LICENSEDIR/$LICENSEFILE"
  84. echo  >> "$LICENSEDIR/$LICENSEFILE"
  85.  
  86. exit 0
  87.